<?php
	$hotel_id = $_GET['id'];
	// Hotel Detail
	$hotel_details = new hotelDetailClass();
	$hotel_details->setParam("t9grpd33pwudkegxpdrq6xp5","55505","en_US","USD",$hotel_id);
	$hotel_detail = $hotel_details->getHotelDetail();
	$hotel_detail = $hotel_detail[0];
	
	//Represent variable detail hotel
	$hotel_id = $hotel_detail->hotelId;
	$hotel_name = $hotel_detail->hotelName;
	$hotel_address = $hotel_detail->hotelAddress;
	$hotel_city = $hotel_detail->hotelCity;
	$hotel_postal_code = $hotel_detail->hotelPostalCode;
	$hotel_country_code = $hotel_detail->hotelCountryCode;
	$hotel_property_category = $hotel_detail->hotelPropertyCategory;
	$hotel_rating = static_function::getStarRating($hotel_detail->hotelRating);
	$hotel_images = $hotel_detail->hotelImages;
	$hotel_overview = htmlspecialchars_decode($hotel_detail->hotelPropertyDescription);
	$hotel_room_information = htmlspecialchars_decode($hotel_detail->hotelRoomInformation);
	$hotel_area_information = htmlspecialchars_decode($hotel_detail->hotelAreaInformation);
	$hotel_policy = htmlspecialchars_decode($hotel_detail->hotelPolicy);
	$hotel_driving_directions = htmlspecialchars_decode($hotel_detail->hotelDrivingDirections);
	$hotel_checkin_instructions = htmlspecialchars_decode($hotel_detail->hotelCheckInInstructions);
	$hotel_room_types = $hotel_detail->hotelRoomTypes;
	$hotel_facilities = $hotel_detail->hotelPropertyAmenities;
	
	// Hotel Room Available
	$hotel_room_available = new hotelRoomAvailableClass();
	$hotel_room_available->setParam("t9grpd33pwudkegxpdrq6xp5","55505","en_US","USD","106347","09/03/2013","09/04/2013","tes");
	$hotel_rooms = $hotel_room_available->getRoomAvailable();
	$hotel_rooms = $hotel_rooms[0];
?>

<div id="hotel-detail">

	<div class="hotel-detail-img">
    	<img src="<?php echo $hotel_images[0]->hotelImageUrl; ?>" alt="<?php echo $hotel_name; ?>" />
    </div>
    <div class="hotel-detail-gallery">
        <h2><?php echo $hotel_name; ?></h2>
        <div><?php echo $hotel_rating; ?></div>
        <h3><?php echo $hotel_address.', '.$hotel_postal_code.', '.$hotel_city; ?></h3>
        <div>
        	<?php
				foreach($hotel_images as $hotel_image){
			?>
        		<div style="float:left; margin:0 5px 5px 0;"><img src="<?php echo $hotel_image->hotelImageUrl; ?>" alt="<?php echo $hotel_name; ?>" width="60" height="60" /></div>
            <?php
				}
			?>
            <div class="clear"></div>
        </div>
    </div>
    <div class="clear"></div>
    
    <div class="quad-content">
    	<h4>Room Available</h4>
        <table cellpadding="0" cellspacing="0" width="100%">
        <?php
			foreach($hotel_rooms->hotelRooms as $room_avl){
				// Represent variable
				$room_description = $room_avl->roomTypeDescription;
				$room_price = $room_avl->RateInfo->ChargeableRateInfo->maxNightlyRate.' '.$room_avl->RateInfo->ChargeableRateInfo->currencyCode;
				$room_occupancy = $room_avl->RateInfo->RoomGroup[0]['numberOfAdults'].' adults '.$room_avl->RateInfo->RoomGroup[0]['numberOfChildren'].' children';
				
		?>
       				<tr>
						<td><?php echo $room_description; ?></td>
                        <td><?php echo $room_occupancy; ?></td>
                    	<td>
                        	<?php echo $room_price; ?>
                        </td>
                    </tr>
        <?php
			}
		?>
        </table>
    </div>
    
    <div class="double-content" style="margin-right:10px;">
    	<h4>Overview</h4>
        <div><?php echo $hotel_overview; ?></div>
    </div>
    <div class="double-content">
    	<h4>Map</h4>
        <div id="hotel-map"></div>
    </div>
    <div class="clear"></div>
    
    <div class="quad-content">
    	<h4>Hotel Facilities</h4>
        <div class="clear5"></div>
        <?php
			$i = 1;
			
			foreach($hotel_facilities as $facility){
		?>
        		<h5><?php echo $facility->amenity; ?></h5>
        <?php
				if($i == 3){
		?>
        			<div class="clear"></div>
        <?php
					$i = 0;
				}
			
				$i++;
			}
		?>
        <div class="clear5"></div>
    </div>
    
    <div class="quad-content" id="accordion">
    	<h4>Hotel Area Information</h4>
        <div><?php echo $hotel_area_information; ?></div>
        <h4>Hotel Room Information</h4>
        <div><?php echo $hotel_room_information; ?></div>
        <h4>Hotel Policy</h4>
        <div><?php echo $hotel_area_information; ?></div>
        <h4>Driving Directions</h4>
        <div><?php echo $hotel_driving_directions; ?></div>
        <h4>Check In Instructions</h4>
        <div><?php echo $hotel_checkin_instructions; ?></div>
    </div>
</div>

<pre><?php // print_r($hotel_detail); ?></pre>
<pre><?php // print_r($hotel_rooms); ?></pre>